<style>
td,th {
  text-align: center;
}
</style>
<script type="text/javascript" language="javascript">// <![CDATA[
function checkAll(checktoggle)
{
  var checkboxes = new Array(); 
  checkboxes = document.getElementsByTagName('input');
	for (var i=0; i<checkboxes.length; i++)  
		{
			if (checkboxes[i].type == 'checkbox')   
				{
					checkboxes[i].checked = checktoggle;
				}
		}
			
}

// ]]></script>
<?php 
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
GLOBAL $desc;
$i = 0;
//print_r($query);
foreach ($query as $row)
	{ 
							
								$title[$i] = $row['title'];
								//echo("Title :".$title[$i]."<br/>");
								$id[$i] = $row['id'];
								//echo("ID :".$id[$i]."<br/>");
								$time_spent[$i]	= $row['time_spent'];
								$i++;
	}						
//print_r ($query2);	
?>

</br>
<form action="<?php echo site_url('user/billing/display_invoice');?>" method="post">

<h1>Tasks for the project:</h1>

</br>
<table >
    <thead>
        <tr>
			<th width="2%">
				&nbsp;
			</th>
            <th width="50%">
				Tasks
			</th>
			<th width="16%">
				Total Time	
			</th>
            <th width="16%">
				Billed Time
			</th>
			<th width="16%">
				Un-Billed Time
			</th>
        </tr>
    </thead>
			
	<tbody>		
		<?php for($i=0; $i<count($query);$i++)
			{?>
		<tr>
			<td >
				<input type="checkbox" name="box[]" value="<?php echo $id[$i];?>">
			</td>
			<td >
				<a href="<?echo site_url('user/tasks/task_detail' . '/' . $id[$i]);?>"><?php echo($title[$i]);?></a>
			</td>
			<td >
				<?php if(isset($time_spent[$i]))
					{
						echo($time_spent[$i]);
					}
				else
					echo("00:00:00")
				?>
			</td>
			<td >
				<?php echo $i;?>
			</td>
			<td >
				<?php echo $i;?>
			</td>
		</tr>
		<?php }?>
	</tbody>		
</table>
<img class="selectallarrow" width="38" height="22" src="<?=base_url()?>assets/img/arrow_ltr.png" alt="With selected:" />
<a onclick="javascript:checkAll(true);" href="javascript:void();">Check All</a>

 / 

<a onclick="javascript:checkAll(false);" href="javascript:void();">Uncheck All</a>
		
<input type="hidden" name="project_id" value="<?php echo $query2;?>">		

</br>
<input type="submit" name="submit">						
</form>	